<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//it" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="it.tcm.TeacherClassMate.beans.UserBean"%>
<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>  
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>   
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ page import="it.tcm.TeacherClassMate.beans.SessionUser" %>
<%@ page import="it.tcm.TeacherClassMate.beans.OrderMainBean" %>
<%@ page import="it.tcm.TeacherClassMate.beans.OrderRowBean" %>
<%@ page import="it.tcm.TeacherClassMate.util.Util" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="org.apache.log4j.Logger"%>


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title></title>
	<%@ include file="css.jsp" %>
	<link rel="shortcut icon" href="images/favicon.ico" />
	<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
	
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	final Logger logger = Logger.getLogger(this.getClass().getName());
	String username = null;
	String email = null;
	SessionUser sessionUser = (SessionUser) request.getSession().getAttribute("sessionUser");
	if (sessionUser != null) {
	    username = sessionUser.getUsername();
	    email = sessionUser.getEmail();
	    logger.info("username found " + username);
	} else {
		logger.error("username not found");
		//redirect
		String redirectURL = "notpermitted.jsp";
		response.sendRedirect(redirectURL);
	}
	OrderMainBean omb = null;
	if (request.getSession().getAttribute(Util.ORDER_MAIN_OBJECT) != null) {
		omb = (OrderMainBean)request.getSession().getAttribute(Util.ORDER_MAIN_OBJECT);
	}
%>	
	
		 <script type="text/javascript"> 
		 
		function control() {
<%			if (request.getAttribute(Util.MAIL_SENDED) != null) { %>
				alert("File allegato alla mail spedita all'indirizzo indicato")
<%			request.removeAttribute(Util.MAIL_SENDED);
			} %>
		}

		function simple_tooltip(target_items, name){
			 $(target_items).each(function(i){
					$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
					var my_tooltip = $("#"+name+i);

					if($(this).attr("title") != "" && $(this).attr("title") != null ){ // checks if there is a title

					$(this).removeAttr("title").mouseover(function(){
							my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
					}).mousemove(function(kmouse){
							my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
					}).mouseout(function(){
							my_tooltip.fadeOut(400);
					});

					}
				});
			}

		$(document).ready(function(){
			 simple_tooltip("a","tooltip");
		});
		
    </script>

</head>

<body id="bodyin" onload="javascript:control();">

<div id="wrapperin">

	<div id="header">
		<div id="logomini">
			
		</div>
		<div id="menuin">
			<ul>
<% if (sessionUser.getAdministrator() != null && sessionUser.getAdministrator().equals(1))  { %>
			    <li><a href="<%=basePath%>welcome.do">Homepage</a></li>
				<li class="current_page_item"><a href="<%=basePath%>choosetemplate.do">Crea verifica</a></li>
				<li><a href="<%=basePath%>startlogged.do">Inserisci dati</a></li>
				<li><a href="<%=basePath%>userverifiche.do">Le mie verifiche</a></li>	
				<li><a href="<%=basePath%>userdata.do">Dati personali</a></li>				
				<li><a href="<%=basePath%>buyveri.do">Compra verifiche</a></li>		
<% } else { %>				
				<li><a href="<%=basePath%>welcome.do">Homepage</a></li>
				<li class="current_page_item"><a href="<%=basePath%>choosetemplate.do">Crea verifica</a></li>
				<li><a href="<%=basePath%>userverifiche.do">Le mie verifiche</a></li>			
				<li><a href="<%=basePath%>buyveri.do">Compra verifiche</a></li>
				<li><a href="<%=basePath%>userdata.do">Dati personali</a></li>			
<% } %>
			</ul>
		</div>
	</div>
		
	<div id="page_inside_2">
	    
		<div id="content_inside_3">	
			
			<div class="post">
				<div class="entry">
					<p style="text-align:center">
						Effettua  il download della verifica. E' possibile scegliere tra diversi formati e modi:<br><br>
					</p>
					<center>
					<table>
						<tr>
							<td align="left">
							<a href="<%=basePath%>DownloadDocx?id=<%=omb.getId().toString()%>"><img src="images/word-icon.png"/></a>
							&nbsp;&nbsp;&nbsp;<a href="<%=basePath%>DownloadResult?id=<%=omb.getId().toString()%>"><img src="images/word-icon.png"/></a>
							</td>
							<td>
							 &nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=basePath%>DownloadZip?id=<%=omb.getId().toString()%>"><img src="images/zip-icon.png"/></a>
							</td>
							<td  align="center">
							 &nbsp;<a href="<%=basePath%>sendzipmail.do?id=<%=omb.getId().toString()%>"><img src="images/mail-icon.png"/></a>
							</td>
						</tr>
						<tr>
							<td align="left">
							&nbsp;&#149;&nbsp;Verifica &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#149;&nbsp;&nbsp;Risultati
							</td>
							<td>
							 &nbsp;&nbsp;&#149;&nbsp;Archivio .zip
							</td>
							<td align="right">
							 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#149;&nbsp;Mail all'indirizzo: <%=email%>
							</td>
						</tr>
					</table>
					</center>
				</div>	
			</div>
				
		</div>
	</div>
	
	<div style="clear: both;">&nbsp;</div>
</div>


<!-- start footer -->
<div id="footer">
	<p id="legal">2012 Luigi Gianlupi. Designed by Luigi Gianlupi.</p>
</div>
<!-- end footer -->
</body>	
</html>

